<div class="content-section introduction">
    <div class="feature-intro">
        <h1>Focus Trap</h1>
        <p>Focus Trap keeps focus within a certain DOM element while tabbing.</p>
    </div>
</div>

<div class="content-section implementation">
    <div pFocusTrap class="card">
        <h5>Input</h5>
        <input id="input" type="text" size="30" pInputText> 
        
        <h5>Float Label</h5>
        <span class="p-float-label">
            <input id="float-input" type="text" size="30" pInputText> 
            <label for="float-input">Username</label>
        </span>

        <h5>Disabled Input</h5>
        <input id="disabled-input" type="text" size="30" pInputText [disabled]="true" />

        <h5>Input with tabindex -1</h5>
        <input type="text" size="30" pInputText tabindex="-1" />

        <h5>Button</h5>
        <button pButton type="button" icon="pi pi-check" label="Check"></button>

        <h5>Disabled Button</h5>
        <button pButton type="button" icon="pi pi-check" [disabled]="true" label="Disabled"></button>

        <h5>Button with tabindex -1</h5>
        <button pButton type="button" icon="pi pi-check" tabindex="-1"  label="Check"></button>
        
        <h5>Dropdown</h5>
        <p-dropdown [options]="cities" [(ngModel)]="selectedCity" placeholder="Select a City" optionLabel="name" [showClear]="true"></p-dropdown>

        <h5>Editor</h5>   
        <p-editor [style]="{'height':'320px'}">
            <ng-template pTemplate="header">
                <span class="ql-formats">
                    <button type="button" class="ql-bold" aria-label="Bold"></button>
                    <button type="button" class="ql-italic" aria-label="Italic"></button>
                    <button type="button" class="ql-underline" aria-label="Underline"></button>
                </span>
            </ng-template>
        </p-editor>
    </div>
</div>

<div class="content-section documentation">
    <p-tabView>
        <p-tabPanel header="Documentation">
            <h5>Import</h5>
<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
import &#123;FocusTrapModule&#125; from 'primeng/focustrap';
</app-code>

            <h5>Getting Started</h5>
            <p>FocusTrap is applied to a container element with the <b>pFocusTrap</b> directive.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;div pFocusTrap&gt;
    //content
&lt;/div&gt;
</app-code>

            <h5>Properties</h5>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Type</th>
                            <th>Default</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>pFocusTrapDisabled</td>
                            <td>boolean</td>
                            <td>false</td>
                            <td>When set as true, focus wouldn't be managed.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h5>Properties</h5>
            <p>Directive has no properties.</p>

            <h5>Events</h5>
            <p>Directive has no events.</p>

            <h5>Styling</h5>
            <p>Directive does not apply any styling to host.</p>

            <h5>Dependencies</h5>
            <p>None.</p>
        </p-tabPanel>

        <p-tabPanel header="Source">
            <a href="https://github.com/primefaces/primeng/tree/master/src/app/showcase/components/focustrap" class="btn-viewsource" target="_blank">
                <span>View on GitHub</span>
            </a>
            <a href="https://stackblitz.com/edit/primeng-focustrap-demo" class="btn-viewsource" style="margin-left: .5em;" target="_blank">
                <span>Edit in StackBlitz</span>
            </a>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;div pFocusTrap&gt;
&lt;div pFocusTrap class="card"&gt;
    &lt;h5&gt;Input&lt;/h5&gt;
    &lt;input id="input" type="text" size="30" pInputText&gt; 
    
    &lt;h5&gt;Float Label&lt;/h5&gt;
    &lt;span class="p-float-label"&gt;
        &lt;input id="float-input" type="text" size="30" pInputText&gt; 
        &lt;label for="float-input"&gt;Username&lt;/label&gt;
    &lt;/span&gt;

    &lt;h5&gt;Disabled Input&lt;/h5&gt;
    &lt;input id="disabled-input" type="text" size="30" pInputText [disabled]="true" /&gt;

    &lt;h5&gt;Input with tabindex -1&lt;/h5&gt;
    &lt;input type="text" size="30" pInputText tabindex="-1" /&gt;

    &lt;h5&gt;Button&lt;/h5&gt;
    &lt;button pButton type="button" icon="pi pi-check" label="Check"&gt;&lt;/button&gt;

    &lt;h5&gt;Disabled Button&lt;/h5&gt;
    &lt;button pButton type="button" icon="pi pi-check" [disabled]="true" label="Disabled"&gt;&lt;/button&gt;

    &lt;h5&gt;Button with tabindex -1&lt;/h5&gt;
    &lt;button pButton type="button" icon="pi pi-check" tabindex="-1"  label="Check"&gt;&lt;/button&gt;
    
    &lt;h5&gt;Dropdown&lt;/h5&gt;
    &lt;p-dropdown [options]="cities" [(ngModel)]="selectedCity" placeholder="Select a City" optionLabel="name" [showClear]="true"&gt;&lt;/p-dropdown&gt;

    &lt;h5&gt;Editor&lt;/h5&gt;   
    &lt;p-editor [style]="&#123;'height':'320px'&#125;"&gt;
        &lt;ng-template pTemplate="header"&gt;
            &lt;span class="ql-formats"&gt;
                &lt;button type="button" class="ql-bold" aria-label="Bold"&gt;&lt;/button&gt;
                &lt;button type="button" class="ql-italic" aria-label="Italic"&gt;&lt;/button&gt;
                &lt;button type="button" class="ql-underline" aria-label="Underline"&gt;&lt;/button&gt;
            &lt;/span&gt;
        &lt;/ng-template&gt;
    &lt;/p-editor&gt;
&lt;/div&gt;
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class FocusTrapDemo &#123;

    selectedCity: string;
   
    cities = [
        &#123;name: 'New York', code: 'NY'&#123;,
        &#123;name: 'Rome', code: 'RM'&#123;,
        &#123;name: 'London', code: 'LDN'&#123;,
        &#123;name: 'Istanbul', code: 'IST'&#123;,
        &#123;name: 'Paris', code: 'PRS'&#123;
    ];
    
&#125;
</app-code>

        </p-tabPanel>
        <p-tabPanel header="StackBlitz">
            <ng-template pTemplate="content">
                <iframe src="https://stackblitz.com/edit/primeng-focustrap-demo?embed=1" style="width: 100%; height: 768px; border: none;"></iframe>
            </ng-template>
        </p-tabPanel>
    </p-tabView>
</div>